package com.yanqu.road.server.cmd.wingroom.workshop;

import com.yanqu.road.pb.wingroom.WingRoomProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.workshop.WorkShopModule;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

/**
 * @author ：zfr
 * @date ：2022/3/20 16:01
 */
@Cmd(code = GameProtocol.S_WING_ROOM_REFRESH_WORK_SHOP_POOL, desc = "工坊刷新商品池子")
public class WorkShopRefreshPoolCmd extends AbstractCommand {
    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        ret = player.getModule(WorkShopModule.class).refreshPool();
    }

    @Override
    public void sendData(GamePlayer player) {
        WingRoomProto.refreshWorShopRespMsg.Builder respMsg = WingRoomProto.refreshWorShopRespMsg.newBuilder();
        respMsg.setRet(ret);
        player.sendPacket(ClientProtocol.U_WING_ROOM_REFRESH_WORK_SHOP_POOL, respMsg);
    }
}
